mod conn;
mod conf;
mod proc;

fn main() {
    let conf = conf::load();
    let exepath = conf::exepath(&conf);
    let exename = conf::exename(&conf);
    let delay = conf::delay(&conf);
    let account = conf::account(&conf);
    let password = conf::password(&conf);
    //读配置完成
    loop{
        std::thread::sleep(std::time::Duration::from_secs(*delay as u64));
        if !conn::check("127.0.0.1", account, password){
            proc::restart_or_start_process(exename, exepath);
            println!("There is something wrong with your FTP server,now reboot it.");
        }
    }
}
